package com.flow.engine.controller;


import com.flow.engine.entity.FlowNodeTemplate;
import com.flow.engine.entity.User;
import com.flow.engine.service.FlowService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author ly163
 */
@RestController
@RequestMapping("/flow")
public class FlowController {

    @Autowired
    private FlowService service;


    @RequestMapping("/createFlow/{flowTemplateId}")
    public Boolean createFlow(@PathVariable Long flowTemplateId,@RequestBody List<FlowNodeTemplate> flowNodeTemplates) {
        return service.createFlow(flowTemplateId,flowNodeTemplates);
    }

    @RequestMapping("/audit")
    public Boolean audit(Long nodeId,String remark,Boolean auditStatus,String userId,String username) {
        return service.audit(nodeId,remark,auditStatus, new User(userId,username));
    }


}
